﻿namespace Borg.AttributeAnalyze.Result
{
    public class DuplicatedExtensionName : ResultBase
    {
        private readonly ExtensionTypeInfo _eti;

        public DuplicatedExtensionName(ExtensionTypeInfo extension1, ExtensionTypeInfo extension2)
            : base(extension1.Assembly, Component.Extension, ResultType.DuplicatedExtensionname, extension1, extension1)
        {
            _eti = extension2;
        }

        public override string ToMsBuildMessageString()
        {
            return string.Format(
                "multiple definition of extension\n{0}extension name: {1}\n{0}class 1: {2}\n{0}class 2: {3}",
                new object[] { GetWhiteSpace(2), Name, TypeName, _eti.TypeName });
        }

        public override MessageType MessageType
        {
            get { return MessageType.Error; }
        }
    }
}

